package com.company.ch05.proxy.dynamic;

import java.lang.reflect.Proxy;

public class MyTest {
    public static void main(String[] args) {
        Subject2 realSubject2 = new RealSubject2();
        MyDynamicProxy handler = new MyDynamicProxy(realSubject2);
        Subject2 proxyInstance = (Subject2)Proxy.newProxyInstance(
                handler.getClass().getClassLoader(),
                realSubject2.getClass().getInterfaces(),
                handler);
        proxyInstance.rentCar("宝马");
    }
}
